<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="/WEB-INF/taglib/jstl.jsp" %>

<c:set var="isRevise" value="${false}"/>
<c:set var="styleRevise" value="" />
<c:if test="${not empty usrInfo}">
	<c:set var="isRevise" value="${true}"/>
	<c:set var="styleRevise" value="style='background-color:#E3E3E3;' readonly='readonly'" />
</c:if>
<div style="margin:2px 2px 2px 2px;">
	<form id="frmUserInfoReg">
		<input type="hidden" name="isMe" value="${isMe}" />
		
		<table class="left-table">
		<tr>
			<td class="usrInfoTitleTd">아이디</td>
			<td class="usrInfoContsTd"><input type="text" id="usrId" name="usrId" value="${usrInfo.usrId}" ${styleRevise} /></td>
		</tr>
		<tr>
			<td class="usrInfoTitleTd">패스워드</td>
			<td class="usrInfoContsTd"><input type="password" id="usrPwd" name="usrPwd" /></td>
		</tr>
		<tr>
			<td class="usrInfoTitleTd">사용자 이름</td>
			<td class="usrInfoContsTd"><input type="text" id="usrName" name="usrName" value="${usrInfo.usrName}" /></td>
		</tr>
		<tr>
			<td class="usrInfoTitleTd">이메일</td>
			<td class="usrInfoContsTd"><input type="text" id="usrEmail" name="usrEmail" value="${usrInfo.usrEmail}" /></td>
		</tr>
		<tr>
			<td class="usrInfoTitleTd">전화번호</td>
			<td class="usrInfoContsTd"><input type="text" id="usrMobile" name="usrMobile" value="${usrInfo.usrMobile}" /></td>
		</tr>
		<tr>
			<td class="usrInfoTitleTd">사용 여부</td>
			<td class="usrInfoContsTd">
				<c:set var="usrUseY" value="checked='checked'" />
				<c:set var="usrUseN" value="" />
				<c:if test="${isRevise && usrInfo.usrUseYN == 'N'}">
					<c:set var="usrUseY" value="" />
					<c:set var="usrUseN" value="checked='checked'" />
				</c:if>

				<input type="radio" name="usrUseYN" value="Y" ${usrUseY} />Y
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" name="usrUseYN" value="N" ${usrUseN} />N
			</td>
		</tr>
		
		<c:choose>
			<c:when test="${isMe}">
				<tr>
					<td class="usrInfoTitleTd" style="height:54px;">그룹</td>
					<td class="usrInfoContsTd">
						<select id="usrGroupLst" name="usrGroupLst" class="usrInfoSelectGrpList" multiple="multiple" disabled="disabled">
						<c:forEach var="items" items="${usrInfoGrpList}" varStatus="i">
							<c:set var="class" value="" />
							<c:if test="${items.grpCompulsoryYN == 'Y'}">
								<c:set var="class" value="style='background-color:#E3E3E3;' disabled='disabled'" />
							</c:if>
							<option value="${items.grpId}" ${class}>${items.grpAlias }</option>
						</c:forEach>
						</select>
					</td>
				</tr>
			</c:when>
			<c:otherwise>
				<tr>
					<td class="usrInfoTitleTd" style="height:54px;">그룹 설정<br/>&nbsp;&nbsp;(더블 클릭)</td>
					<td class="usrInfoContsTd">
						<div style="float:left;">
							<select id="groupLst" class="usrInfoSelectGrpList" multiple="multiple">
							<c:forEach var="items" items="${usrGrpList}" varStatus="i">
								<option value="${items.grpId}">${items.grpAlias }</option>
							</c:forEach>
							</select>
							&nbsp;
							<select id="usrGroupLst" name="usrGroupLst" class="usrInfoSelectGrpList" multiple="multiple">
							<c:forEach var="items" items="${usrInfoGrpList}" varStatus="i">
								<c:set var="class" value="" />
								<c:if test="${items.grpCompulsoryYN == 'Y'}">
									<c:set var="class" value="style='background-color:#E3E3E3;' disabled='disabled'" />
								</c:if>
								<option value="${items.grpId}" ${class}>${items.grpAlias }</option>
							</c:forEach>
							</select>
						</div>
						<div style="float:left; padding:0; margin:0; top:0; left:0;">
							<div style="clear:both;">
								<input type="button" id="usrGroupUpArrow" value="▲" style="font-size:8pt;" />
							</div>
							
							<div style="clear:both; width:100%; height:2px; .height:0px;"></div>
							
							<div style="clear:both;">
								<input type="button" id="usrGroupDwArrow" value="▼" style="font-size:8pt;" />
							</div>
						</div>
					</td>
				</tr>			
			</c:otherwise>
		</c:choose>

		<tr>
			<td class="usrInfoTitleTd" style="height:86px;">설명</td>
			<td class="usrInfoContsTd">
				<textarea id="usrDesc" name="usrDesc" style="width:95%; height:80px; resize:none;">${usrInfo.usrDesc}</textarea>
			</td>
		</tr>
		</table>
	</form>
</div>
<div class="usrInfoBtnsDiv">
	<c:choose>
	<c:when test="${isRevise}"><input type="button" id="jqwFormReviseSaveBtn" value="수정" /></c:when>
	<c:otherwise><input type="button" id="jqwFormSaveBtn" value="저장" /></c:otherwise>
	</c:choose>
	
	<input type="button" id="jqwCloseBtn" value="닫기" />
</div>

<script type="text/javascript" src="/resources/js/views/template/system/userInfo/_regForm.js"></script>
<script type="text/javascript" src="/resources/js/views/template/system/userInfo/_regFormValid.js"></script>